// Problem: D - Distributing Ballot Boxes
// Idea: Binary Search + Greedy
// Language: C++
// Author: Ivan Vladimirov Ivanov (ivan.vladimirov.ivanov@gmail.com)

#include <cstdio>
#include <algorithm>

using namespace std;

#define MAX 500005

int  input(void);
void solve(void);

int try_it(int x);

int n, m;
int P[MAX];

int main(void)
{
  while(input()) solve();

  return 0;
}

int input(void)
{
  scanf("%d %d", &n, &m);
  if(n == -1 && m == -1) return 0;
  for(int i = 0; i < n; i++) scanf("%d", &P[i]);
  return 1;
}

void solve(void)
{
  int left = 1;
  int right = 5000005;
  int res = right;
  while(left <= right) {
    int mid = (left + right) / 2;
    if(try_it(mid)) {
      right = mid - 1;
      res = mid;
    }
    else {
      left = mid + 1;
    }
  }
  printf("%d\n", res);
}

int try_it(int x)
{
  int cnt = 0;
  for(int i = 0; i < n; i++) {
    cnt += P[i] / x + (P[i] % x ? 1 : 0);
    if(cnt > m) break;
  }
  return cnt <= m;
}

